﻿<Window x:Class="JobBoardAdminPanel.Views.EditTownsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="EditTownsWindow" Height="600" Width="900">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="0,4*"/>
            <RowDefinition Height="0,5*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="Country: " FontWeight="ExtraBold"/>
            <ComboBox ItemsSource="{Binding Countries}" Width="150" Height="25" SelectedItem="{Binding CurrentCountry}"
                      DisplayMemberPath="CountryName"/>
        </StackPanel>

        <DataGrid Grid.Row="1" ItemsSource="{Binding Cities}" AutoGenerateColumns="True" IsReadOnly="True"
                  CanUserAddRows="False"
                  SelectedItem="{Binding CurrentCity}">
        </DataGrid>

        <Grid Grid.Row="2">
            <StackPanel>
                <TextBlock Text="EditItem" FontWeight="ExtraBold"/>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="ID: " Width="40"/>
                    <TextBlock Text="{Binding CurrentCity.Id}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Name:" Width="40"/>
                    <TextBox Width="150" Text="{Binding CurrentCity.CityName}" />
                    <Button Name="ButtonSave" Content="Save" Command="{Binding SaveCommand}"/>
                    <Button Name="ButtonDelete" Content="Delete" Command="{Binding DeleteCommand}"/>
                </StackPanel>
                <TextBlock Text="InsertItem" FontWeight="ExtraBold"/>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Name:" Width="40"/>
                    <TextBox Width="150" Text="{Binding NewCity.CityName}" />
                    <Button Name="ButtonAdd" Content="Add" Command="{Binding AddCommand}"/>
                </StackPanel>
            </StackPanel>

            <Button Name="BackToMain" Content="Back to main" FontWeight="bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="50" Width="150" Click="BackToMain_Click"/>
        </Grid>

    </Grid>
</Window>
